package admin

import database "hft/Database"

type Api struct {
	database.Base
	RouteID  int     `json:"route_id" gorm:"uniqueIndex:route_api_name_index"`
	ApiName  string  `json:"api_name,omitempty" gorm:"uniqueIndex:route_api_name_index"`
	ApiPath  string  `json:"api_path,omitempty" gorm:"type:varchar(255);size:255;uniqueIndex:route_api_name_index"`
	ApiType  string  `json:"api_type,omitempty"`
	Roles    []*Role `json:"roles" gorm:"many2many:_roles_apis;constraint:OnDelete:CASCADE,OnUpdate:NO ACTION"`
	IsLogger int     `json:"is_logger" gorm:"tinyint(1);size:(1);default:1"` //2表示不存入日志 1表示存入日志
	IsAll    int     `json:"is_all" gorm:"tinyint(1);size:(1);default:2"`    //2表示不是公共 1表示是公共
}

func (Api) TableName() string {
	return database.TableNameFormat("apis")
}
